<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>服务注册与发现工具比较</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            line-height: 1.8;
            color: #333;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }
        .tool-icon {
            font-size: 2.5rem;
            margin-bottom: 1rem;
            color: #6e8efb;
        }
        .mermaid {
            background-color: #f8fafc;
            padding: 2rem;
            border-radius: 0.5rem;
            margin: 2rem 0;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4">
        <div class="container mx-auto max-w-5xl text-center">
            <h1 class="text-4xl md:text-5xl font-bold mb-6">探索服务注册与发现工具</h1>
            <p class="text-xl md:text-2xl mb-8 font-light opacity-90">构建分布式系统的关键技术比较</p>
            <div class="w-24 h-1 bg-white mx-auto mb-12"></div>
            <p class="text-lg max-w-3xl mx-auto leading-relaxed">
                在微服务架构中，服务注册与发现是确保系统弹性和可扩展性的核心组件。了解主流工具的特性差异，为您的项目做出明智选择。
            </p>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl px-4 py-16">
        <!-- Intro Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 text-gray-800 border-b border-gray-200 pb-4">服务注册与发现概述</h2>
            <div class="grid md:grid-cols-2 gap-8 items-center">
                <div>
                    <p class="text-lg text-gray-700 mb-6">
                        在分布式系统中，服务注册与发现机制允许服务实例自动注册自己并向客户端提供服务位置信息。这实现了服务的动态发现和负载均衡，是构建弹性微服务架构的基础。
                    </p>
                    <p class="text-gray-600">
                        除了Eureka之外，市场上还有多种优秀的工具和框架可以实现这一功能，每种工具都有其独特的设计理念和适用场景。
                    </p>
                </div>
                <div class="bg-white p-6 rounded-lg shadow-md">
                    <div class="mermaid">
                        graph TD
                            A[客户端] -->|查询| B[服务注册中心]
                            B -->|返回服务列表| A
                            A -->|请求| C[服务实例1]
                            A -->|请求| D[服务实例2]
                            C -.->|注册| B
                            D -.->|注册| B
                    </div>
                </div>
            </div>
        </section>

        <!-- Tools Comparison -->
        <section class="mb-20">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b border-gray-200 pb-4">主流工具比较</h2>
            
            <div class="grid md:grid-cols-2 gap-8">
                <!-- Consul Card -->
                <div class="bg-white rounded-lg shadow-md overflow-hidden card-hover">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <i class="fas fa-network-wired tool-icon"></i>
                            <h3 class="text-2xl font-bold ml-4 text-gray-800">Consul</h3>
                        </div>
                        <p class="text-gray-700 mb-4">
                            Consul是一个分布式的服务发现和配置管理工具，提供完整的服务网格解决方案。它支持多数据中心部署，内置服务注册、发现和健康检查功能。
                        </p>
                        <div class="flex flex-wrap gap-2 mt-4">
                            <span class="px-3 py-1 bg-blue-100 text-blue-800 rounded-full text-sm">多数据中心</span>
                            <span class="px-3 py-1 bg-blue-100 text-blue-800 rounded-full text-sm">健康检查</span>
                            <span class="px-3 py-1 bg-blue-100 text-blue-800 rounded-full text-sm">KV存储</span>
                        </div>
                    </div>
                    <div class="bg-gray-50 px-6 py-4 border-t border-gray-200">
                        <a href="#" class="text-blue-600 hover:text-blue-800 font-medium flex items-center">
                            了解更多 <i class="fas fa-arrow-right ml-2"></i>
                        </a>
                    </div>
                </div>

                <!-- ZooKeeper Card -->
                <div class="bg-white rounded-lg shadow-md overflow-hidden card-hover">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <i class="fas fa-vector-square tool-icon"></i>
                            <h3 class="text-2xl font-bold ml-4 text-gray-800">ZooKeeper</h3>
                        </div>
                        <p class="text-gray-700 mb-4">
                            ZooKeeper是一个高性能的分布式协调服务，采用ZAB协议保证一致性。其临时节点特性非常适合服务注册与发现场景，被广泛应用于Hadoop、Kafka等生态。
                        </p>
                        <div class="flex flex-wrap gap-2 mt-4">
                            <span class="px-3 py-1 bg-purple-100 text-purple-800 rounded-full text-sm">强一致性</span>
                            <span class="px-3 py-1 bg-purple-100 text-purple-800 rounded-full text-sm">临时节点</span>
                            <span class="px-3 py-1 bg-purple-100 text-purple-800 rounded-full text-sm">Watcher机制</span>
                        </div>
                    </div>
                    <div class="bg-gray-50 px-6 py-4 border-t border-gray-200">
                        <a href="#" class="text-purple-600 hover:text-purple-800 font-medium flex items-center">
                            了解更多 <i class="fas fa-arrow-right ml-2"></i>
                        </a>
                    </div>
                </div>

                <!-- Spring Cloud Discovery Card -->
                <div class="bg-white rounded-lg shadow-md overflow-hidden card-hover">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <i class="fas fa-leaf tool-icon"></i>
                            <h3 class="text-2xl font-bold ml-4 text-gray-800">Spring Cloud Discovery</h3>
                        </div>
                        <p class="text-gray-700 mb-4">
                            Spring Cloud Discovery提供了服务注册与发现的抽象接口，可以与Eureka、Consul、ZooKeeper等多种注册中心集成。为Java开发者提供了统一的编程模型。
                        </p>
                        <div class="flex flex-wrap gap-2 mt-4">
                            <span class="px-3 py-1 bg-green-100 text-green-800 rounded-full text-sm">抽象接口</span>
                            <span class="px-3 py-1 bg-green-100 text-green-800 rounded-full text-sm">多种集成</span>
                            <span class="px-3 py-1 bg-green-100 text-green-800 rounded-full text-sm">Spring生态</span>
                        </div>
                    </div>
                    <div class="bg-gray-50 px-6 py-4 border-t border-gray-200">
                        <a href="#" class="text-green-600 hover:text-green-800 font-medium flex items-center">
                            了解更多 <i class="fas fa-arrow-right ml-2"></i>
                        </a>
                    </div>
                </div>

                <!-- Nacos Card -->
                <div class="bg-white rounded-lg shadow-md overflow-hidden card-hover">
                    <div class="p-6">
                        <div class="flex items-center mb-4">
                            <i class="fas fa-cloud tool-icon"></i>
                            <h3 class="text-2xl font-bold ml-4 text-gray-800">Nacos</h3>
                        </div>
                        <p class="text-gray-700 mb-4">
                            Nacos是一个更现代的注册中心和配置中心，支持服务注册与发现、动态配置管理和服务健康监测。由阿里巴巴开源，适合云原生应用。
                        </p>
                        <div class="flex flex-wrap gap-2 mt-4">
                            <span class="px-3 py-1 bg-yellow-100 text-yellow-800 rounded-full text-sm">配置管理</span>
                            <span class="px-3 py-1 bg-yellow-100 text-yellow-800 rounded-full text-sm">云原生</span>
                            <span class="px-3 py-1 bg-yellow-100 text-yellow-800 rounded-full text-sm">高可用</span>
                        </div>
                    </div>
                    <div class="bg-gray-50 px-6 py-4 border-t border-gray-200">
                        <a href="#" class="text-yellow-600 hover:text-yellow-800 font-medium flex items-center">
                            了解更多 <i class="fas fa-arrow-right ml-2"></i>
                        </a>
                    </div>
                </div>
            </div>
        </section>

        <!-- Feature Comparison -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-gray-800 border-b border-gray-200 pb-4">功能特性对比</h2>
            <div class="overflow-x-auto">
                <table class="min-w-full bg-white rounded-lg overflow-hidden">
                    <thead class="bg-gray-100">
                        <tr>
                            <th class="py-3 px-4 text-left font-semibold text-gray-700">特性</th>
                            <th class="py-3 px-4 text-left font-semibold text-gray-700">Consul</th>
                            <th class="py-3 px-4 text-left font-semibold text-gray-700">ZooKeeper</th>
                            <th class="py-3 px-4 text-left font-semibold text-gray-700">Spring Cloud</th>
                            <th class="py-3 px-4 text-left font-semibold text-gray-700">Nacos</th>
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-gray-200">
                        <tr>
                            <td class="py-3 px-4 font-medium">服务注册</td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                        </tr>
                        <tr class="bg-gray-50">
                            <td class="py-3 px-4 font-medium">健康检查</td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                        </tr>
                        <tr>
                            <td class="py-3 px-4 font-medium">多数据中心</td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-times text-red-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-times text-red-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                        </tr>
                        <tr class="bg-gray-50">
                            <td class="py-3 px-4 font-medium">配置管理</td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-times text-red-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                        </tr>
                        <tr>
                            <td class="py-3 px-4 font-medium">DNS接口</td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-times text-red-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-times text-red-500"></i></td>
                            <td class="py-3 px-4"><i class="fas fa-check text-green-500"></i></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </section>

        <!-- Selection Guide -->
        <section class="bg-white rounded-lg shadow-md p-8 mb-16">
            <h2 class="text-3xl font-bold mb-6 text-gray-800">如何选择合适的工具？</h2>
            <div class="grid md:grid-cols-2 gap-8">
                <div>
                    <h3 class="text-xl font-semibold mb-4 text-gray-700">考虑因素</h3>
                    <ul class="space-y-3">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                            <span>项目规模和复杂性</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                            <span>是否需要多数据中心支持</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                            <span>团队熟悉的技术栈</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-blue-500 mt-1 mr-2"></i>
                            <span>是否需要集成配置管理</span>
                        </li>
                    </ul>
                </div>
                <div>
                    <h3 class="text-xl font-semibold mb-4 text-gray-700">推荐场景</h3>
                    <div class="space-y-4">
                        <div>
                            <h4 class="font-medium text-gray-800">Consul</h4>
                            <p class="text-gray-600 text-sm">需要多数据中心、完整服务网格解决方案的企业级应用</p>
                        </div>
                        <div>
                            <h4 class="font-medium text-gray-800">Nacos</h4>
                            <p class="text-gray-600 text-sm">云原生应用，需要注册中心和配置中心一体化解决方案</p>
                        </div>
                        <div>
                            <h4 class="font-medium text-gray-800">Spring Cloud</h4>
                            <p class="text-gray-600 text-sm">基于Spring生态的Java应用，需要灵活选择注册中心</p>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12">
        <div class="container mx-auto max-w-5xl px-4">
            <div class="text-center">
                <h3 class="text-xl font-bold text-white mb-2">技术小馆</h3>
                <p class="mb-6">探索技术世界的知识宝库</p>
                <a href="http://www.yuque.com/jtostring" class="text-blue-400 hover:text-blue-300 transition-colors">
                    <i class="fas fa-external-link-alt mr-2"></i> http://www.yuque.com/jtostring
                </a>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>